UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'W5IryRfqbDrS7D8TCm5/xWwK2qdSFBLY5nVesLai5qk=' 
WHERE 
  key_id = '38baebf8fb40816e7952fca1ff0136d3230989898085d9f64df6a95327011818' 
  AND (
    token = 'W5IryRfqbDrS7D8TCm5/xWwK2qdSFBLY5nVesLai5qk=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00025