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

Query time 0.00032