UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'Xtl0tXQ6vgGGqd6libGiNxng4wYmMDoAFdtkhnhlsNE=' 
WHERE 
  key_id = '3500fba7c39f58ed72690b49ed8399f1c6120d834dc9549df284c0057969a416' 
  AND (
    token = 'Xtl0tXQ6vgGGqd6libGiNxng4wYmMDoAFdtkhnhlsNE=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00048