UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'ewG3SXnN1sMquSqVwJCBd5EZ0qwLQVlJtvBMowfRSmo=' 
WHERE 
  key_id = '52a6327581d98bc57f7dfbd9b9bd7602c648eb5ef74e455e1403a6643561045d' 
  AND (
    token = 'ewG3SXnN1sMquSqVwJCBd5EZ0qwLQVlJtvBMowfRSmo=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00030