UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'EmkliqK7A5ngXKf2RyOQp3s4Tg2W+h6Ji2nZi5vv95c=' 
WHERE 
  key_id = 'c84b573ab0368ab66e9156ae47af51d9bb47b4d65cbbc920e29b42530a11a9ee' 
  AND (
    token = 'EmkliqK7A5ngXKf2RyOQp3s4Tg2W+h6Ji2nZi5vv95c=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00041