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

Query time 0.00030