UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'eTHTB25xk8sQUVb7j1PatNGHipWoh1l5w3ngZ1OU5uo=' 
WHERE 
  key_id = '86eb651b519c46e7f939421e22ae9987719032ef1e68ce0229e603ac781edc78' 
  AND (
    token = 'eTHTB25xk8sQUVb7j1PatNGHipWoh1l5w3ngZ1OU5uo=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00028