UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'x3IoOENUpemnbn4WObRj1sedp72dpuycJvZBLShoAJI=' 
WHERE 
  key_id = '03994ba9d4c07426a40177f15320a3f47d45aea4714cf91044b57d1879c24485' 
  AND (
    token = 'x3IoOENUpemnbn4WObRj1sedp72dpuycJvZBLShoAJI=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00027