UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'uUOFVzOAMQCmroqqQdv4eDC2fPkxhCnkCVo2a94kYm0=' 
WHERE 
  key_id = '8ac6e796218c122cdf49c6032919f508e96d5715f8cfbbafadc149419660a7e9' 
  AND (
    token = 'uUOFVzOAMQCmroqqQdv4eDC2fPkxhCnkCVo2a94kYm0=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00016