UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '/5rp9elcDb3cV3JRc8e9J56NQKXliGV9ptZE4n8xoag=' 
WHERE 
  key_id = 'c75e84a61295e99d09f40693af737cea5ff545fdbc440eb4baae95634ca68578' 
  AND (
    token = '/5rp9elcDb3cV3JRc8e9J56NQKXliGV9ptZE4n8xoag=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00024