UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'TGBhw4XVUeVy1SPc5Ty2A2J/tVQj0YHUwFY3QbY83WM=' 
WHERE 
  key_id = '8f93fdfe0ee73b076d59202e44684206fb5fb0029d225522e2eac41d075fb4a3' 
  AND (
    token = 'TGBhw4XVUeVy1SPc5Ty2A2J/tVQj0YHUwFY3QbY83WM=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00018