UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'TKb/F91gnKT40kU6oo7isq9UTmNISc2PWo0uHQBuLBg=' 
WHERE 
  key_id = '81c330c3f98800fcf34e5e48daa858ee83487bfd866c8127b79858203124fe89' 
  AND (
    token = 'TKb/F91gnKT40kU6oo7isq9UTmNISc2PWo0uHQBuLBg=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00046