UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'q2dEhCfPsmjjwV/A/waRv/yZzi4FGE6pydI0gqe3M94=' 
WHERE 
  key_id = '31b0c8bd5d6b0e24e61df1fe89e6606a388f10ae40173877769ae712874642c0' 
  AND (
    token = 'q2dEhCfPsmjjwV/A/waRv/yZzi4FGE6pydI0gqe3M94=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00022