UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'awDRUT9MvafHvsoLmRW/DIAtsS/GCpPHlcxQPQkk0zU=' 
WHERE 
  key_id = 'd460b56bfd7e04c4cf3debf558d3b305f363f8055c111234447730affd1957b0' 
  AND (
    token = 'awDRUT9MvafHvsoLmRW/DIAtsS/GCpPHlcxQPQkk0zU=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00024