UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'pONvw+1mKoH+mXHL4Q87yAZXk0mrZfDALu4QLXmGsDo=' 
WHERE 
  key_id = 'c709e09f447d9ec312549e3b420a918695354617e47959ae80b1c2060d6d4699' 
  AND (
    token = 'pONvw+1mKoH+mXHL4Q87yAZXk0mrZfDALu4QLXmGsDo=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00046