UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'EHTvm5BfBD5ibIKPcOQqV0UAeaoBDddddEOEojGoLAk=' 
WHERE 
  key_id = '2f0674218a1b6c3e5e405d481afc3da0e129d7325bd301c3bedefce401c1be78' 
  AND (
    token = 'EHTvm5BfBD5ibIKPcOQqV0UAeaoBDddddEOEojGoLAk=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00042