UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'Wd5j+LwP+dBMYOOpLuOyTCS6DniHA8dBs/t8FlItWpQ=' 
WHERE 
  key_id = 'a671d599d66ea0f95ef326563d34d36e3a904de555922bbce9f1e3ebc3e16518' 
  AND (
    token = 'Wd5j+LwP+dBMYOOpLuOyTCS6DniHA8dBs/t8FlItWpQ=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00047