UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'eMJSTs7Oo0wcPstKIzLguTKixtyyoqWm2UnlXKBlw58=' 
WHERE 
  key_id = '01d4c6c1741d3bb0b20285bd04e715e5a42b66a85c98c7213a59e1248b90731e' 
  AND (
    token = 'eMJSTs7Oo0wcPstKIzLguTKixtyyoqWm2UnlXKBlw58=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00041