UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'L+LZE4mN8D9N00FzTONu4c6Afy9tYaPGXqYWW7RyXQ8=' 
WHERE 
  key_id = 'bc2f6c90b6186df86ba921234997608267dad51bea1e4452aaa349b821711f7b' 
  AND (
    token = 'L+LZE4mN8D9N00FzTONu4c6Afy9tYaPGXqYWW7RyXQ8=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00030