UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'lZ9FlDswt4KVWl6w1ZtSM7pJpytz6tYFREZ0POJqEXU=' 
WHERE 
  key_id = 'df2a593e952a97a4eed350147812c21ad0e4780e871fcc6c9a00c5f32cc0abc3' 
  AND (
    token = 'lZ9FlDswt4KVWl6w1ZtSM7pJpytz6tYFREZ0POJqEXU=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00040