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

Query time 0.00036