UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'cMvjRU6+mcw5U4QmLfgFdCIy0AMSIqCei9iiQHRYc2s=' 
WHERE 
  key_id = 'c8497c9bea5d72398bfa3cdd27e00946b62671991e67f19534e3e1963c20b4fc' 
  AND (
    token = 'cMvjRU6+mcw5U4QmLfgFdCIy0AMSIqCei9iiQHRYc2s=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00032