UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'gYk4E4Xt6jq/xTp74WptnTabR3EOfw4HH76qakVcu4Q=' 
WHERE 
  key_id = '8c111b5a5ef540d93c63db45c6f65803742c9892fbc87df1d09eacbca1aeade0' 
  AND (
    token = 'gYk4E4Xt6jq/xTp74WptnTabR3EOfw4HH76qakVcu4Q=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00035