UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'oibXGoCwbk9kSkCngI6jWdE9Dih0m+hm9w/QR3hnz1o=' 
WHERE 
  key_id = '39e03247deec89d543cd872eb2f6c9bc5af0a83cdd478c8f8595a334ddaa4ac5' 
  AND (
    token = 'oibXGoCwbk9kSkCngI6jWdE9Dih0m+hm9w/QR3hnz1o=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00031