UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'Nxh9m1qdO17VvsfsAUQw8e05varkuctT+lX6F+87rWo=' 
WHERE 
  key_id = '5fa73cb4050e1fffea5971eed823639a630911ddeca00a61adc3eba0e3e125b7' 
  AND (
    token = 'Nxh9m1qdO17VvsfsAUQw8e05varkuctT+lX6F+87rWo=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00030