UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'OqisWZgC2m+KQGMlUQCn3GvVo9TU0GLuEML1RwCXYs4=' 
WHERE 
  key_id = '935ae4906ab140f3d68034ab39356df863f6d00eed2e57157eef7742396ef425' 
  AND (
    token = 'OqisWZgC2m+KQGMlUQCn3GvVo9TU0GLuEML1RwCXYs4=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00067