UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'dMMyjzgOvoFoBqZFEGSXip1nGW8CNl6/nWaRRHakEkY=' 
WHERE 
  key_id = '24d18db845018a67b05455f9e821a71567dd75c505a5e9818b4423d0a9d9b1ac' 
  AND (
    token = 'dMMyjzgOvoFoBqZFEGSXip1nGW8CNl6/nWaRRHakEkY=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00037