UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'UsPv60RDe3504BQdV+gExCMj3GffU4vruf3AzSI59Nc=' 
WHERE 
  key_id = '98021c78e2f74b7d095e32975d3312bc04d8ee8e471def91b0942e9d56a0899f' 
  AND (
    token = 'UsPv60RDe3504BQdV+gExCMj3GffU4vruf3AzSI59Nc=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00040