UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'hzx61OUApCYZwXu12/LuQtWacvZsKlNNeEAWSfCKbgo=' 
WHERE 
  key_id = '50c6a269a561cf11a432cbd13472fa5332be7cbc60244f4e09b31421cd66539e' 
  AND (
    token = 'hzx61OUApCYZwXu12/LuQtWacvZsKlNNeEAWSfCKbgo=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00039