UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'qUelxs9p9KfYGVU4RuAl89gSGEDhb+K/wtISNiCAeFA=' 
WHERE 
  key_id = 'ca47525e3042dd0a334fd674d96bf4f1061b0048aa353289dd242eb9cf779c25' 
  AND (
    token = 'qUelxs9p9KfYGVU4RuAl89gSGEDhb+K/wtISNiCAeFA=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00018