UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'KEx34xcSpEmuSZxIdomnjsMUEfZoRNQbBpSMkPBPSEo=' 
WHERE 
  key_id = 'b3aa65449ac83dd18268f7421efdb9c10be65a4deaafb143f38466865534e56b' 
  AND (
    token = 'KEx34xcSpEmuSZxIdomnjsMUEfZoRNQbBpSMkPBPSEo=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00030