UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'GJz+wYYZMi3eZomOpr9OqAschyIQKjDmcDSv0xr8tb8=' 
WHERE 
  key_id = '47afbf8fa01f702d68622b18ca1005ff8f5b65395f90a4fb0796dd916eba8e15' 
  AND (
    token = 'GJz+wYYZMi3eZomOpr9OqAschyIQKjDmcDSv0xr8tb8=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00036