UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'w8lXlsagAMzhr9y7Y7GF/a+SeRS801evATpUFePknHU=' 
WHERE 
  key_id = '6f0c3518c52f9786ac8c2a559006a597174bf0132c56bc2721c08bc223a24af4' 
  AND (
    token = 'w8lXlsagAMzhr9y7Y7GF/a+SeRS801evATpUFePknHU=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00026