UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'BBXJ4z2oyynqQ9DDpsJ7X5rt03xVPzL9AtpnXYsH/FU=' 
WHERE 
  key_id = '27abde4a849b5301c1388234fb7841a309b3344340ec107ce4cdaf204383929d' 
  AND (
    token = 'BBXJ4z2oyynqQ9DDpsJ7X5rt03xVPzL9AtpnXYsH/FU=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00054